//===============================================================================
// Microsoft patterns & practices
// Web Client Software Factory
//-------------------------------------------------------------------------------
// Copyright (C) Microsoft Corporation.  All rights reserved.
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY
// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
// LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE.
//-------------------------------------------------------------------------------
// The example companies, organizations, products, domain names,
// e-mail addresses, logos, people, places, and events depicted
// herein are fictitious.  No association with any real company,
// organization, product, domain name, email address, logo, person,
// places, or events is intended or should be inferred.
//===============================================================================
using System;
using System.Collections.ObjectModel;

namespace WCSFContrib.PageFlow
{
    /// <summary>
    /// Defines the contract for the page flow definition.
    /// </summary>
    /// <remarks>A page flow determines the control- and data-flow between the Web pages comprising a Web client. The definition holds the behavior and state that is common across instances. It corresponds to the type side of the Type Object pattern.</remarks>
	public interface IPageFlowDefinition
	{
        /// <summary>
        /// Returns the flavor of abandonable behavior.
        /// </summary>
		AbandonBehavior Abandonable { get; }

        /// <summary>
        /// Gets the page to be displayed if the page flow is aborted.
        /// </summary>
		Page AbortPage { get; }

        /// <summary>
        /// Tests whether the page flow is constrained.
        /// </summary>
        /// <remarks>A constrained page flow redirects the user to the current page if they request a different page.</remarks>
		bool Constrained { get; }

        /// <summary>
        /// Gets the definition name.
        /// </summary>
		string Name { get; }

        /// <summary>
        /// Tests whether the page flow is redirecting.
        /// </summary>
		string NotRunningRedirect { get; }

        /// <summary>
        /// Gets the pages comprising the page flow.
        /// </summary>
		ReadOnlyCollection<Page> Pages { get; }

        /// <summary>
        /// Gets the starting page of the page flow.
        /// </summary>
		Page StartPage { get; }

        /// <summary>
        /// Gets the CLR type associated with the page flow definition.
        /// </summary>
		Type PageFlowType { get; }

        /// <summary>
        /// Tests whether a page is part of the page flow definition.
        /// </summary>
        /// <param name="page">The target page.</param>
        /// <returns>True if the page flow contains the target page.</returns>
		bool ContainsPage(Page page);

        /// <summary>
        /// Tests whether an URL represents a page within the page flow definition.
        /// </summary>
        /// <param name="url">The target URL.</param>
        /// <returns>True if the page flow contains the target URL.</returns>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings", MessageId = "0#")]
        bool ContainsUrl(string url);

        /// <summary>
        /// Returns the page mapped to a page flow state.
        /// </summary>
        /// <param name="stateName">The target page flow state.</param>
        /// <returns>The page corresponding to the target page flow state.</returns>
        Page GetPage(string stateName);

        /// <summary>
        /// Returns the page mapped to a URL.
        /// </summary>
        /// <param name="url">The target URL.</param>
        /// <returns>The page corresponding to the target URL.</returns>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings", MessageId = "0#")]
        Page GetPageFromUrl(string url);
	}
}
